package com.example.mvn.demo.controller;

import com.example.mvn.demo.dao.RewriteUserDao;
import com.example.mvn.demo.model.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhouzeng
 * @date 2019/1/14
 */
@Controller
public class TestController {
    @Autowired
    private RewriteUserDao userDao;

    @RequestMapping("api/v1/helloWorld")
    @ResponseBody
    public Integer helloWorld() {
        User u = new User();
        userDao.create(u);
        User user = userDao.load(1L);
        return user.getId().intValue();
    }
}
